import lxml.etree as le

with open('edu.html','r',encoding='utf_8') as f:
    html = f.read()
    html_x = le.HTML(html) # 把 html 转换成 xpath，使用 html_x.xpath('写入 xpath 语句') 提取信息
    div_x_s = html_x.xpath('//div[@class="classify_cList"]')
    data_s=[]
    for div_x in div_x_s:
        category1 = div_x.xpath('./h3/a/text()')[0]
        category2_s = div_x.xpath('./div/span/a/text()')
        data_s.append(
            dict(
                category1 = category1,
                category2_s = category2_s
            )
        )
print(data_s)
for category1 in data_s:
    # print(category1)
    print(category1.get('category1'))
    for category2 in category1.get('category2_s'):
        print('   '+category2)